Many modern computer systems employ a hierarchical approach to the storage of data by combining a main memory with auxiliary storage, such as disk drives and tape drives. Frequently, during its active processing function a host computer, made up of a central processing unit ("CPU") and a main memory, will access a disk drive for the purpose of transferring data which is no longer needed in main memory to the disk, or retrieving data which is needed in main memory from the disk.
A tape drive, on the other hand, is not typically used as an active storage resource, but rather is used as a back-up storage system. In other words, the storage of data on tape is generally for the purpose of creating a redundant or archival copy of the data stored on disk, rather than for the storage of data that will be regularly accessed during processing operations. Therefore, if the data stored elsewhere, such as on a disk, gets erased or corrupted, the tape copy can be accessed and the data can be recovered.
Consequently, of all the time during which the host interacts with a related tape drive, the vast majority will be spent writing data to the tape, while a relatively minor amount will be spent reading data from the tape. Reading usually only occurs when lost data needs to be recovered or archived data needs to be accessed.
In many system configurations, the data that is to be written onto the tape is first transferred to the host from the disk drive, and then sent by the host to the tape drive via the system bus. There are many tape drive systems which use large, mechanical motors for the movement of the tape; these are generally referred to as "start/stop tapes". The advantage of such large motors is that they can start and stop the tape almost instantaneously. Therefore, when a given package of data, referred to as a "block", is to be written onto the tape, the tape drive will be signaled by the host computer and the large motor will immediately wind the tape and ramp up to the constant velocity at which time data can be written onto the tape. That velocity is also the same velocity at which data is read from the tape, and so it is referred to as the "read/write velocity", or given that the greatest number of transactions are of the write variety, it may simply be referred to as the "write velocity". After the block is written, the tape will be stopped immediately, as well. When the next block is to be written onto the tape, the tape will again be instantaneously started without leaving any appreciable blank space on the tape between the first and second blocks. Consequently, start/stop tapes are capable of storing data as soon as the host is ready to send it, and the start/stop tape will not force the host computer to wait for the tape to get ready to receive the data, an event which is commonly referred to as a "host stall".
The disadvantage, however, of tape drives with large mechanical motors is that they take up a significant amount of physical space, and they are relatively expensive. Therefore, other tape drive systems use smaller, less expensive mechanical motors for the movement of the tape. One disadvantage of such smaller tape drives, referred to as "streaming tapes", is that because of the small motors the tapes cannot be started and stopped instantaneously. When a block is to be written, the tape will gradually ramp up to its write velocity, and then, when it is done writing, the tape will gradually slow down and stop. In order to prepare the tape for the next write operation, and in order to maximize the use of the storage space available on the tape, after the streaming tape stops it will actually rewind past the point at which the last block is stored on the tape. Therefore, when it next commences a write operation it will be able to ramp up to its write velocity while it winds the part of the tape on which the previous block has already been written. Through proper synchronization, by the time the tape drive reaches the blank portion of the tape on which the new block is to be written, it will have reached its write velocity.
Unlike the start/stop tape, a streaming tape is not capable of ramping up to its appropriate write velocity when the host computer first signals that it is ready to send data. This is because the small mechanical motor takes time to ramp up. Therefore, while the tape winding mechanism gradually increases its velocity, the host computer would be delayed while it waits for the tape drive to signal its availability. In order not to stall the host in this fashion, however, many tape drive controllers include a storage buffer, made up of an electronic memory, such as a random access memory ("RAM"). Thus, the host can immediately send the data to the tape drive, which will first be stored in the buffer, and then transferred to the tape when the tape reaches its write velocity. Buffers thereby improve the immediate storage capability of a streaming tape. It should be noted that although the cost of adding an electronic buffer to the tape drive is offset by the benefit of improved performance, RAM storage is relatively expensive. Therefore, there is a tendency to keep the size of the buffer as small as is consistent with overall design objectives, including cost.
In some system designs, as soon as any data arrives in the buffer the mechanical assembly which moves the tape across the tape heads will begin winding the tape, and after the tape reaches the necessary velocity, the data in the buffer can be written onto the tape and the buffer emptied. Other system designs do not begin the operation of the mechanical assembly as soon as data arrives in the buffer; rather, they have an established threshold which must be reached before the tape drive begins winding the tape. For example, one design may require that the amount of data in the buffer reaches the 60% full point before the mechanical assembly begins operation. This buffer data threshold at which the tape drive begins its winding operation is commonly referred to as a "watermark". In either case, whether the watermark is set low (or zero) or high, that watermark is fixed and unvarying within the given system.
On the other hand, the rate at which data is sent by the host computer is not fixed and will vary over time. In other words, the data may be "bursty", coming from the host in constantly changing data rates. This may be caused by any number of factors, such as the delay experienced by the host in getting data from the disk drive, interruption of the CPU by higher priority processing functions, unavailability of the system bus due to other modules using the bus, and the like.
Tape controller buffers which have fixed watermarks--such as a low or a high watermark--may encounter several problems as a result of the host computer sending data at varying rates. This is because a fixed watermark which is optimal for a slow data input rate may not work well with a fast input rate. For example, a buffer which has a fixed, zero watermark will commence winding the tape and reading the buffer at the first instant that data is transferred to the buffer. This low watermark tends to work well if the input data rate from the host computer is fast or high, relative to the rate at which data can be written onto the tape. On the other hand, if the rate at which data is being sent from the host is slow, it will not take the tape drive very long to empty the buffer. As soon as the buffer is emptied, the tape will stop, rewind, and reposition for the next write operation. Assuming that the host continues to write data into the buffer at the same slow rate, the tape drive will repeatedly empty an only partially full buffer, and repeatedly stop, rewind, and reposition.
Consequently, the tape drive will constantly be repositioning itself which has the effect of excessive mechanical wear on the tape, a phenomenon known as "shoeshine", and also excessive wear on the heads of the tape drive. Both of these are undesirable and costly effects of constant repositioning which results when a buffer with a low watermark receives data at a relatively slow rate. Therefore, although a low watermark may work well when the input data rate is high, it has substantial drawbacks when the input data rate is low.
As another example, a buffer which has a fixed, high watermark --such as 60%--will wait until the buffer is 60% full before it starts the mechanical assembly which moves the tape. In this instance, the fixed watermark setting tends to work well with slow data input rates. On the other hand, if the rate at which the data is being sent by the host is very high, relative to the rate at which data can be written onto the tape, then the mechanical tape drive assembly may not be able to reach its write velocity before the buffer reaches its full state. If that is so, and the buffer is filled before data can be written onto the tape, the tape controller will be forced to signal to the host that the buffer cannot accept anymore data, at least until some of the buffer is emptied. This will cause a host stall, which tends to degrade system performance.
Then, after the buffer is emptied, the tape will rewind and reposition itself. In the meanwhile, assuming that data is still being sent at a relatively high rate, the tape will not begin to ramp up until the buffer is 60% full, which will again result in the tape drive stalling the host because the buffer will fill and the tape drive will not be able to absorb all the data that the host is prepared to send.
Therefore, it can be seen that under certain circumstances buffers which have fixed watermarks, whether high or low, will precipitate undesirable consequences. Low fixed watermark buffers may cause excessive tape repositionings when their data input rate is low, resulting in excessive mechanical wear on the tape and tape heads; high fixed watermark buffers may cause the host computer to stall its delivery of data, resulting in a degradation in system performance.
Accordingly, it is an object of the present invention to have a tape controller buffer with an optimal watermark even though the rate at which data is written by the host computer may constantly vary. A feature of the invention, therefore, is to have an adjustable watermark, which continues to vary on the basis of whether the buffer was too full to accept data from the host at the time it commences a given write operation. It does so by referring back to the condition of the buffer during the previous write cycle. If the buffer was not completely filled, which means that the host computer was not kept waiting for the availability of the tape drive, then the watermark will be raised. If, however, the buffer was filled such that the host could not store any more data in it, then the watermark is lowered so that the tape winding mechanism will start the ramp up procedure sooner than it did during the previous write cycle. In this sense, the tape controller "learns" from the experience of the previous write cycle, and responds by adjusting the threshold.
It is also an object of the invention to implement the same adjustable threshhold or watermark for the buffer in connection with read operations. During read operations the watermark varies on the basis of whether the buffer could have been emptier before it commences a given read operation, otherwise its principles of operation are fundamentally the same as during write operations.
Advantages achieved by this invention include an improvement in the compatibility of the tape drive with a host computer which transfers data at varying rates. By having an adjustable watermark, the availability of the tape drive to accept data from or send data to the host can be increased which will result in fewer stalls of the host computer. Fewer stalls of the host by the tape drive will have a corresponding improvement on the overall system performance. Furthermore, due to its adaptability, the adjustable watermark will reduce the number of unnecessary repositionings of the tape, thereby reducing the mechanical wearing of the tape and the tape heads.